<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
  },
});
</script>

<template>
  <view class="note-item">
    <view class="note-item-cover" v-if="info.text_type !== 3">
      <image class="note-item-img" :src="info.pic_url" lazy-load />
      <image
        class="note-item-video"
        v-if="info.text_type === 2"
        src="@/package/my/static/like-list-video.png"
      />
    </view>
    <view class="note-item-content">
      <view class="note-item-name">{{ info.title }}</view>
      <view style="display: flex; align-items: center">
        <image class="note-item-avatar" :src="info.head_img" lazy-load />
        <view class="note-item-guider">{{ info.nick_name }}</view>
      </view>
    </view>
  </view>
</template>

<style lang="scss">
.note-item {
  display: flex;
  align-items: center;
  padding: 20rpx;
  border-radius: 20rpx;
  background-color: #ffffff;

  .note-item-cover {
    position: relative;
    flex-shrink: 0;
    margin-right: 20rpx;
  }

  .note-item-img {
    display: block;
    width: 144rpx;
    height: 108rpx;
    border-radius: 10rpx;
  }

  .note-item-video {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40rpx;
    height: 40rpx;
    transform: translate(-50%, -50%);
  }

  .note-item-content {
    flex-grow: 1;
    min-width: 0;
  }

  .note-item-name {
    height: 72rpx;
    margin-bottom: 8rpx;
    font-size: 26rpx;
    color: #333333;
    line-height: 36rpx;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .note-item-avatar {
    flex-shrink: 0;
    width: 34rpx;
    height: 34rpx;
    border-radius: 50%;
  }

  .note-item-guider {
    flex-grow: 1;
    min-width: 0;
    margin-left: 10rpx;
    font-size: 24rpx;
    color: #666666;
    line-height: 34rpx;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}
</style>